<?php


namespace app\reception\server;


use app\common\model\NovelChapter;
use app\common\model\NovelClass;
use app\common\model\NovelClassSon;
use app\common\model\NovelFreq;

class ContentServer
{

    /**
     * 批量获取分类信息
     * @param $cidArr
     * @return array
     */
    public static function plGetNovelClass($cidArr){
        return NovelClass::where('id','in',$cidArr)->cache(6000)->column('name','id');
    }

    /**
     * 批量获取频道信息
     * @param $fidArr
     * @return array
     */
    public static function plGetNovelFreq($fidArr){
        return NovelFreq::where('id','in',$fidArr)->cache(6000)->column('name','id');
    }


    /**
     * 子分类频道信息
     * @param $sidArr
     * @return array
     */
    public static function plGetNovelClassSon($sidArr){
        return NovelClassSon::where('id', 'in', $sidArr)->cache(6000)->column('name', 'id');
    }

    /**
     * 批量获取最大章节
     * @param $nidArr
     * @return array
     */
    public static function plGetMaxChapterNo($nidArr){
        return NovelChapter::where('novel_id', 'in', $nidArr)->group('novel_id')->cache(6000)->column("max(chapter_no) max_no", 'novel_id');
    }

}